<template>
  <avue-form
    ref="form"
    :defaults.sync="defaults"
    :option="option"
    v-model="form"
    @submit="handleSubmit"
    @error="error"
    v-loading="loading"
  >
    <template slot="attachVOS">
      <easy-upload style="display: inline" :drag="false" v-model="form.attachVOS" />
    </template>
  </avue-form>
</template>

<script>
import { option } from '@/option/tenant/supplier/bak/info-record'
import { save, submit, detail } from '@/api/supplier/bak/inforecord'
export default {
  name: 'ChangeInfo',
  props: ['changeId'],
  data: () => ({
    defaults: {},
    form: {
      outbound: '',
      busLicense: '',
      attachVOS: []
    },
    loading: false,
    option: option.call(this),
    contactList: []
  }),
  mounted() {
    this.loading = true
    detail({ changeId: this.changeId }).then(res => {
      if (res.data.success) {
        this.form = res.data.data
        this.loading = false
      }
    })
  },
  methods: {
    handleSave() {
      save(this.form).then(res => {
        if (res.success) {
          this.$message({
            type: 'success',
            message: '操作成功!'
          })
        }
      })
    },
    handleNext() {
      submit(this.form).then(res => {
        if (res.success) {
          this.$message({
            type: 'success',
            message: '操作成功!'
          })
        }
      })
    }
  }
}
</script>
